#ifndef _UBT_STATE_DIAGRAM_H_
#define _UBT_STATE_DIAGRAM_H_
#include "std_msgs/msg/bool.hpp"
#include "std_msgs/msg/u_int8.hpp"
#include "std_msgs/msg/u_int32.hpp"
#include "std_msgs/msg/float32.hpp"
#include "std_msgs/msg/int8_multi_array.hpp"
#include "geometry_msgs/msg/twist.hpp"
#include "geometry_msgs/msg/pose_with_covariance_stamped.hpp"
#include "nav_msgs/msg/occupancy_grid.hpp"
#include "geometry_msgs/msg/point32.hpp"
#include "ubt_interface/msg/wifi_info.hpp"
#include "std_msgs/msg/float32_multi_array.hpp"
#include "tf2/exceptions.h"
#include "tf2/transform_datatypes.h"

#include "tf2_ros/transform_listener.h"
#include "tf2_ros/buffer.h"

#include "ubt_interface/srv/set_footprint.hpp"
#include "ubt_interface/srv/set_stop_distance.hpp"
#include "ubt_interface/srv/set_enable.hpp"
#include "ubt_interface/srv/bel_pose.hpp"
#include "ubt_interface/srv/odom_reset.hpp"

#include "ubt_interface/msg/battery_data.hpp"
#include "ubt_interface/msg/rfid.hpp"
#include "ubt_interface/msg/characteristic.hpp"
#include "ubt_interface/msg/nav_req.hpp"

#include "ubt_state_types.h"
#include "ubt_state_api.h"
#include <yaml-cpp/yaml.h>
#include <yaml-cpp/node/parse.h>



#include <xmlrpc-c/base.hpp>
#include <xmlrpc-c/registry.hpp>
#include <xmlrpc-c/server.h>
#include "node.h"


#ifdef UBT_ALGS_QRCODE_SUPPORT
    #include "ubt_interface/msg/pose2d_stamped.hpp"
#endif

namespace ubt_state
{
enum ubt_locate_alg
{
    ubt_locate_alg_amr,
#ifdef UBT_USLAM_SUPPORT
    ubt_locate_alg_uslam,
#endif
#ifdef UBT_ALGS_QRCODE_SUPPORT
    ubt_locate_alg_qrcode,
    ubt_locate_alg_mag
#endif
};

typedef struct _CStateDiagramCfg
{
    std::string state_save_file;
    int obstacle_alarm_duration;//单位秒,默认1800，避障状态持续时间超过该值报警
    ObstacleParams obsParams;//导航避障参数
    float obstacle_run_start_up_dis; // 导航起步避障参数
    float obstacle_mapping_dis;//建图避障距离
    float obstacle_rmctl_dis;//遥控避障距离
    float obstacle_auto_find_dis;//遥控避障距离
    std::string init_poses;//初始停靠点列表,    x=1.0&y=2.0&theta=120&name=n1&type=charge;x=1.5&y=2.3&theta=-120&name=n2&type=rest;
    std::string last_pose; //上次关机点,   x=0&y=0&theta=0
    float first_locate_bel_threshold;//首次定位,置信度大于等于该值，视为定位成功
    float pose_fail_bel_threshold;//置信度小于等于该值,视为定位丢失

    ubt_locate_alg loc_alg;

    float pose_check_dis;//mrpt位姿与里程位姿一致性检查的距离间隔,单位米
    float pose_check_ratio;//一致性阈值, 小位姿/大位姿>=ratio 视为正常，否则异常

    int nav2_check_timeout; //nav2是否检测超时,0 不检测,1 检测

    float robot_width;
    float robot_length;
    float rack_width;       //货架长度
    float rack_length;      //货架宽度
    float rack_legLength;   //货架腿长度
    float rack_legWidth;    //货架腿宽度
    float rack_dis; //货架避障长度距离
} CStateDiagramCfg;

typedef struct
{
    geometry_msgs::msg::Pose2D pose;
    std::string name;
    std::string type;
} StatePoseEx;

typedef struct
{
    int state;//0 不检查，1 检查
    geometry_msgs::msg::Pose2D prevPose;//上个检查点位姿
    geometry_msgs::msg::Pose2D prevOdomPose;//上个检查点里程位姿
    double disMax;//最大距离
} PoseChecker;

class CStateDiagram: public ITaskCb
{
  public:
    CStateDiagram();
    ~CStateDiagram();
    // 运行
    int Run(int argc, char *argv[]);

    virtual StateStatus *GetStateStatus();
    virtual void  NotifyTaskEvent(std::string taskEvent);
    virtual void  NotifyTaskStateAndStage(int state, int stage, int stateReason, std::string stateReasonDesc);

    void Stop_Carto_Callback(const std_msgs::msg::String::SharedPtr msg);
    void Lift_Speed_And_Distance_Screen_Callback(const std_msgs::msg::Float32MultiArray::SharedPtr msg);
    void Fixedpath_Task_Callback(const std_msgs::msg::String::SharedPtr msg);
    void UI_Command_Callback(const std_msgs::msg::String::SharedPtr msg);
    void Task_Limit_Index_Callback(const std_msgs::msg::String::SharedPtr msg);

    void OnTimer();
    void auto_find_Avoid();

    void Cmd_Vel_callback(const geometry_msgs::msg::Twist::SharedPtr msg);
    void UI_Twist_Callback(const geometry_msgs::msg::Twist::SharedPtr msg);
    void Location_CallBack(const geometry_msgs::msg::PoseWithCovarianceStamped::SharedPtr msg);
#ifdef UBT_ALGS_QRCODE_SUPPORT
    void Location_QrCode_CallBack(const ubt_interface::msg::Pose2dStamped::SharedPtr msg);
    void Rack_QrCode_CallBack(const ubt_interface::msg::Pose2dStamped::SharedPtr msg);
#endif
#if (PLAT_USE == PLAT_U1000)
    void Event_Emergency_Callback(const std_msgs::msg::UInt32::SharedPtr msg);
    void Event_Reset_Callback(const std_msgs::msg::UInt32::SharedPtr msg);
    void Ble_Conn_State_Callback(const std_msgs::msg::UInt32::SharedPtr msg);
    void Update_Callback(const std_msgs::msg::UInt8::SharedPtr msg);
    void Power_State_Int_Callback(const std_msgs::msg::UInt32::SharedPtr msg);
    void Charging_State_Callback(const std_msgs::msg::UInt32::SharedPtr msg);
    void Charging_Pile_Callback(const std_msgs::msg::UInt32::SharedPtr msg);
    void Charging_Connect_Callback(const std_msgs::msg::UInt32::SharedPtr msg);
#else
    void Mb_Status_Callback(const std_msgs::msg::UInt32::SharedPtr msg);
    void Pb_Status_Callback(const std_msgs::msg::UInt32::SharedPtr msg);
    void Pb_Charge_Status_Callback(const std_msgs::msg::UInt8::SharedPtr msg);
#endif
    void Event_Collision_Callback(const std_msgs::msg::UInt32::SharedPtr msg);
    void Event_Brake_Callback(const std_msgs::msg::UInt32::SharedPtr msg);
    void Event_lifting_Callback(const std_msgs::msg::UInt32::SharedPtr msg);
#ifdef UBT_LIFT_SUPPORT
    void Event_Limit_CallBack(const std_msgs::msg::UInt32::SharedPtr msg);
#endif
#ifdef UBT_DRAG_SUPPORT
    void Event_Drag_CallBack(const std_msgs::msg::UInt32::SharedPtr msg);
    void traction_latch_abnormal_state_CallBack(const std_msgs::msg::UInt32::SharedPtr msg);
    
#endif
    void Wifi_Info_Callback(const ubt_interface::msg::WifiInfo::SharedPtr msg);
    void Batterydata_Callback(const ubt_interface::msg::BatteryData::SharedPtr msg);
    void Obstacle_Laser_Callback(const std_msgs::msg::UInt8::SharedPtr msg);
    void Obstacle_Rgbd_Callback(const std_msgs::msg::UInt8::SharedPtr msg);
    void Joystick_Status_Callback(const std_msgs::msg::Bool::SharedPtr msg);
    void Init_Find_Callback(const std_msgs::msg::String::SharedPtr msg);
    void Init_Find_Res_Callback(const std_msgs::msg::String::SharedPtr msg);
    void Map_Confidence_Callback(const std_msgs::msg::Float32::SharedPtr msg);
    void Standalone_Mode_Callback(const std_msgs::msg::Bool::SharedPtr msg);

    void UI_PoseConfirm_Callback(const std_msgs::msg::String::SharedPtr msg);
    void UI_ConfigUpdate_Callback(const std_msgs::msg::String::SharedPtr msg);
    void UI_BleSpeed_Callback(const std_msgs::msg::Int8MultiArray::SharedPtr msg);
    void OdomPose_CallBack(const geometry_msgs::msg::Pose2D::SharedPtr msg);
    void Track_out_CallBack(const std_msgs::msg::String::SharedPtr msg);
    void Mqtt_Status_CallBack(const std_msgs::msg::UInt8::SharedPtr msg);
    void Top_Laser_Com_CallBack(const std_msgs::msg::UInt32::SharedPtr msg);
    void Nav_Fail_CallBack(const std_msgs::msg::UInt32::SharedPtr msg);
    void Left_Laser_Com_CallBack(const std_msgs::msg::UInt32::SharedPtr msg);
    void Right_Laser_Com_CallBack(const std_msgs::msg::UInt32::SharedPtr msg);
    void end_rfid_broken_CallBack(const std_msgs::msg::String::SharedPtr msg);
    void rfidNotAtPath(const std_msgs::msg::UInt8::SharedPtr msg);
    
    void Muti_Map_List_Callback(const std_msgs::msg::String::SharedPtr msg);
    void Ui_characteristic_Callback(const std_msgs::msg::UInt8::SharedPtr msg);
    void Rfid_Callback(const ubt_interface::msg::Rfid::SharedPtr msg);
    void Start_pause_CallBack(const std_msgs::msg::UInt8::SharedPtr msg);
    // void Ble_con_CallBack(const std_msgs::msg::UInt32::SharedPtr msg);
    void Finish_task_CallBack(const std_msgs::msg::UInt8::SharedPtr msg);

    void UI_MapUpdate_Callback(const nav_msgs::msg::OccupancyGrid::SharedPtr msg);

#ifdef UBT_USLAM_SUPPORT
    void InitialPoseUslam_Callback(const geometry_msgs::msg::PoseWithCovarianceStamped::SharedPtr msg);
#endif
  private:
    // initializer
    void _InitForROS();
    bool _RefreshState();
    //获取硬件状态,0 无故障,1 顶升到顶部，2 松开解抱闸, 3  线充,4 顶升到中间,9 按下急停,10 防撞条触发,11 左轮/右轮/滚筒电机报警
    int _GetHwStatus();
    void _SetState(ubt_diagram_state newState);
    void _EnterInitial();
    void _PublishInitialPose(geometry_msgs::msg::Pose2D _initpose);
    void _PublishState() ;
    void _PublishRmctlMode();
    void _PublishScreenMode();
    void _PublishAlarmForObstacle();
    void _OnTimerInInitial();
    void _OnTimerInInitPose();
    void _CheckObstacleStatus();
    void _CheckExpInfo(int type);
    void _SetObsParams(int type);
#ifdef UBT_USLAM_SUPPORT
    bool _SyncMap(nav_msgs::msg::OccupancyGrid& map);
#endif
    void _SetPoseState(int poseState);
    void _SetRackInfo(const FixePathTaskInfo& taskInfo);
    void _SetStopDis(const FixePathTaskInfo& taskInfo);
    void _PoseCheckerTimeout();
    void _NotifyEvent(int evType, std::string evMsg);
    void _NotifyTaskStatus(std::string taskId, std::string status, int actionIndex, std::string actionType, std::string desc);

    bool _LoadCfg();
    int  _SaveCfg();
    void _LoadDyamicCfg();

    void _visualFinePositioning();

    void _autoLinePatrolPause(bool isPause);

    void _callAebEnable(bool isEnable);

    CStateDiagramCfg _cfg;
    std::vector<StatePoseEx> _initPoses;//可能的初始位姿列表

    // handle

    rclcpp::TimerBase::SharedPtr _timer;

    rclcpp::Publisher<std_msgs::msg::String>::SharedPtr _pub_inital_state;//发布定位成功失败结果
    rclcpp::Publisher<geometry_msgs::msg::PoseWithCovarianceStamped>::SharedPtr _pub_initial; //发布重定位命令
    rclcpp::Publisher<geometry_msgs::msg::Twist>::SharedPtr _pub_instance_twist; //发布无需平滑的速度
    rclcpp::Publisher<geometry_msgs::msg::Twist>::SharedPtr _pub_smooth_twist; //发布需平滑的速度

    rclcpp::Publisher<std_msgs::msg::String>::SharedPtr _pub_state; //发布状态
    rclcpp::Publisher<std_msgs::msg::String>::SharedPtr _pub_status; //发布详细状态
    rclcpp::Publisher<geometry_msgs::msg::Pose2D>::SharedPtr _pub_current_pose;//发布当前位姿
    rclcpp::Publisher<std_msgs::msg::String>::SharedPtr _pub_task_event;//发布任务事件
    rclcpp::Publisher<std_msgs::msg::String>::SharedPtr _pub_reset_dispatch;
    rclcpp::Publisher<std_msgs::msg::String>::SharedPtr _pub_task_status;
    rclcpp::Publisher<std_msgs::msg::String>::SharedPtr _pub_obstacle_alarm;
    rclcpp::Publisher<std_msgs::msg::UInt8>::SharedPtr _pub_rmctl_mode;
    rclcpp::Publisher<std_msgs::msg::Float32MultiArray>::SharedPtr _pub_obstacle_exp;// 发布膨胀距离
    rclcpp::Publisher<std_msgs::msg::Float32>::SharedPtr _pub_rgbd_high_height;// 发布rgbd检测高度
    rclcpp::Publisher<std_msgs::msg::String>::SharedPtr _pub_msg_warn; //发布警告信息
    rclcpp::Publisher<std_msgs::msg::String>::SharedPtr _pub_ui_state; //发布取消任务
    rclcpp::Publisher<std_msgs::msg::String>::SharedPtr _pub_init_find_rfid;//发布rfid初始化
    rclcpp::Publisher<std_msgs::msg::UInt8>::SharedPtr _pub_characteristic;//特征扫描
    rclcpp::Publisher<ubt_interface::msg::Characteristic>::SharedPtr _pub_characteristic_res;//特征扫描反馈
    rclcpp::Publisher<std_msgs::msg::UInt8>::SharedPtr _pub_clean_recover_task;//发给rosbridge
    rclcpp::Publisher<std_msgs::msg::String>::SharedPtr _pub_refault_detail;//可恢复故障详细
    rclcpp::Publisher<std_msgs::msg::Bool>::SharedPtr _pub_standalone_mode;
    
    // 测试-pub
    rclcpp::Publisher<std_msgs::msg::UInt32>::SharedPtr _pub_agv_state;
    rclcpp::Publisher<std_msgs::msg::UInt32>::SharedPtr _pub_agv_stage;
    rclcpp::Publisher<ubt_interface::msg::NavReq>::SharedPtr _pub_nav_req;
    
#ifdef UBT_LIFT_SUPPORT
    rclcpp::Publisher<std_msgs::msg::Float32>::SharedPtr _pub_lift_speed;// 发布顶升速度
    rclcpp::Publisher<std_msgs::msg::Float32MultiArray>::SharedPtr _pub_lift_speed_and_distance;//发布货叉顶升高度
    rclcpp::Subscription<std_msgs::msg::Float32MultiArray>::SharedPtr _sub_lift_speed_and_distance_screen;
#endif
    // subscriber
    rclcpp::Subscription<std_msgs::msg::UInt8>::SharedPtr _sub_start_pause;
    rclcpp::Subscription<std_msgs::msg::UInt32>::SharedPtr _sub_ble_con;
    rclcpp::Subscription<std_msgs::msg::UInt8>::SharedPtr _sub_finish_task;
    rclcpp::Subscription<ubt_interface::msg::Rfid>::SharedPtr _sub_rfid;
    rclcpp::Subscription<std_msgs::msg::UInt8>::SharedPtr _sub_ui_characteristic;
    rclcpp::Subscription<std_msgs::msg::String>::SharedPtr _sub_stop_carto;
    rclcpp::Subscription<std_msgs::msg::String>::SharedPtr _sub_fixedpath_task;
    rclcpp::Subscription<std_msgs::msg::String>::SharedPtr _sub_ui_state;
    rclcpp::Subscription<std_msgs::msg::String>::SharedPtr _sub_task_limit_index;

    // rclcpp::Subscription _sub_initpose_status;
    rclcpp::Subscription<geometry_msgs::msg::Twist>::SharedPtr _sub_ui_twist;
    rclcpp::Subscription<geometry_msgs::msg::Twist>::SharedPtr _sub_cmd_vel;
    rclcpp::Subscription<geometry_msgs::msg::PoseWithCovarianceStamped>::SharedPtr _sub_loc_pose;
#ifdef UBT_ALGS_QRCODE_SUPPORT
    rclcpp::Subscription<ubt_interface::msg::Pose2dStamped>::SharedPtr _sub_loc_qrcode_pose;
    rclcpp::Subscription<ubt_interface::msg::Pose2dStamped>::SharedPtr _sub_rack_qrcode_pose;
#endif
#if (PLAT_USE == PLAT_U1000)
    rclcpp::Subscription<std_msgs::msg::UInt32>::SharedPtr _sub_event_emergency;
    rclcpp::Subscription<std_msgs::msg::UInt32>::SharedPtr _sub_event_reset;
    rclcpp::Subscription<std_msgs::msg::UInt32>::SharedPtr _sub_ble_conn_state;
    rclcpp::Subscription<std_msgs::msg::UInt32>::SharedPtr _sub_power_state_int;
    rclcpp::Subscription<std_msgs::msg::UInt32>::SharedPtr _sub_charging_state;
    rclcpp::Subscription<std_msgs::msg::UInt32>::SharedPtr _sub_charging_pile;
    rclcpp::Subscription<std_msgs::msg::UInt32>::SharedPtr _sub_charging_connect;
#else
    rclcpp::Subscription<std_msgs::msg::UInt32>::SharedPtr _sub_mb_status;
    rclcpp::Subscription<std_msgs::msg::UInt32>::SharedPtr _sub_pb_status;
    rclcpp::Subscription<std_msgs::msg::UInt8>::SharedPtr _sub_pb_charge_status;
#endif
    rclcpp::Subscription<std_msgs::msg::UInt32>::SharedPtr _sub_event_collision;
    rclcpp::Subscription<std_msgs::msg::UInt32>::SharedPtr _sub_event_brake;
    rclcpp::Subscription<std_msgs::msg::UInt32>::SharedPtr _sub_event_lifting;
#ifdef UBT_LIFT_SUPPORT
    rclcpp::Subscription<std_msgs::msg::UInt32>::SharedPtr _sub_event_limit;
#endif
#ifdef UBT_DRAG_SUPPORT
    rclcpp::Subscription<std_msgs::msg::UInt32>::SharedPtr _sub_event_drag;
    rclcpp::Subscription<std_msgs::msg::UInt32>::SharedPtr _sub_traction_latch_abnormal_state;
#endif
    rclcpp::Subscription<ubt_interface::msg::WifiInfo>::SharedPtr _sub_wifi_info;
    rclcpp::Subscription<ubt_interface::msg::BatteryData>::SharedPtr _sub_battery_data;
    rclcpp::Subscription<std_msgs::msg::UInt8>::SharedPtr _sub_obstacle_laser;
    rclcpp::Subscription<std_msgs::msg::UInt8>::SharedPtr _sub_obstacle_rgbd;
    rclcpp::Subscription<std_msgs::msg::Bool>::SharedPtr _sub_joystick_status;
    rclcpp::Subscription<nav_msgs::msg::OccupancyGrid>::SharedPtr _sub_map; //订阅地图
    rclcpp::Subscription<std_msgs::msg::String>::SharedPtr _sub_muti_map_list;//获取map点数据
    rclcpp::Subscription<std_msgs::msg::String>::SharedPtr _sub_init_rfid;//
    rclcpp::Subscription<std_msgs::msg::String>::SharedPtr _sub_init_rfid_res;//寻找rfid初始化
    rclcpp::Subscription<std_msgs::msg::Float32>::SharedPtr _sub_pose_confidence; //订阅置信度
    rclcpp::Subscription<std_msgs::msg::String>::SharedPtr _sub_pose_confirm; //校验定位确认
    rclcpp::Subscription<std_msgs::msg::String>::SharedPtr _sub_ui_config_update;//ui配置有更新
    rclcpp::Subscription<std_msgs::msg::Int8MultiArray>::SharedPtr _sub_ble_speed;//遥控最大速度设置
    rclcpp::Subscription<std_msgs::msg::UInt8>::SharedPtr _sub_update;//更新中
    rclcpp::Subscription<geometry_msgs::msg::Pose2D>::SharedPtr _sub_odom_pose;//里程计位姿
    rclcpp::Subscription<std_msgs::msg::String>::SharedPtr _sub_track_out;
    rclcpp::Subscription<std_msgs::msg::UInt8>::SharedPtr _sub_mqtt_status;
    rclcpp::Subscription<std_msgs::msg::UInt32>::SharedPtr _sub_top_laser_error;
    rclcpp::Subscription<std_msgs::msg::UInt32>::SharedPtr _sub_nav_fail;//nav fail
    rclcpp::Subscription<std_msgs::msg::UInt32>::SharedPtr _sub_left_laser_error;
    rclcpp::Subscription<std_msgs::msg::UInt32>::SharedPtr _sub_right_laser_error;
    rclcpp::Subscription<std_msgs::msg::String>::SharedPtr _sub_end_rfid_broken;
    rclcpp::Subscription<std_msgs::msg::Bool >::SharedPtr _sub_standalone_mode;
    rclcpp::Subscription<std_msgs::msg::UInt8>::SharedPtr _sub_rfid_not_at_path;

    //client
    rclcpp::Client<ubt_interface::srv::OdomReset>::SharedPtr _cli_odom_reset;
    rclcpp::Client<ubt_interface::srv::SetFootprint>::SharedPtr _set_footprint_client;
    rclcpp::Client<ubt_interface::srv::BelPose>::SharedPtr _cli_initnode_belpose;
    
    // rclcpp::Client _set_stop_distance_client;
    rclcpp::Client<ubt_interface::srv::SetEnable>::SharedPtr _set_aeb_enable_client;
#ifdef UBT_USLAM_SUPPORT
    ros::ServiceClient _cli_uslam_setmap;
    rclcpp::Subscription<geometry_msgs::msg::PoseWithCovarianceStamped>::SharedPtr _sub_uslam_pose;
    nav_msgs::msg::OccupancyGrid _curMap;
#endif
    ubt_diagram_state _curState;
    ubt_diagram_state _lastState;//上次状态
    long _curStateEnterTime;//进入当前状态时间
    ITask *_curTask; //当前任务
    std::string _curTaskId;//当前任务Id
    bool _needArrived;//是否需要报导航结束
    int _curTaskFlag;  //任务标志,ubt_task_flag_xx


    ubt_state_pub _statePub;//用于发布的状态
    long _statePubEnterTime;
    StateStatus _curStatus;
    bool _bStopTrigged;//曾按下过急停
    int _newChargingConnect;//充电连接状态
    std_msgs::msg::UInt32 _last_ble_con_state;

    int _initPoseBelCnt;	//已计算置信度的位姿数
    int              _initPoseSel;//初始选择的位姿索引
    double  		 _initPoseBel;//初始选择的置信度
    geometry_msgs::msg::Pose2D _initPose;//初始选择的位姿

    long  _avoid_laser_state_stime;//雷达状态开始时间
    long  _avoid_rgbd_state_stime;//rgbd状态开始时间
    int   _obstacle_alarm_cnt;//已报警次数

    int _rmctlMode;	//遥控模式 0 不允许，1 蓝牙允许,2 手柄允许
    int _screen_pub_mode; //f1200屏幕货叉控制 0 无发送，1 下降，2 上升
    bool _isRefault;//是否充电失败

    PoseChecker _poseChecker;
    int _charge_connect_count = 0;//创建连接次数
    std::string _agv_type;//当前agv类型
    std::string _current_pose_type;//当前上报点位方式
    std::vector<Point> _map_points;//地图所有点信息
    int _is_characteristic; //是否特征扫描
    bool _is_initial;//是否初始化
    bool _auto_find_obs;//自动巡线时，是否避障
    bool _pub_InitialPose;//是否需要发布initial_pose(有slam的时候使用)
    std::string  _characteristic_rfid;
    bool _is_finish_current_task;//是否完成了当前任务
    bool _is_update;
    int _event_emergency_msg;//急停当前生效值
    std_msgs::msg::String refaultDetailMsg;//可恢复故障详细信息
    bool _autoFindPauseFlag = false; // 自巡线/单机空跑时暂停标志

};
#define ubt_task_flag_autopause  0x01
#define ubt_task_flag_manualpause  0x02

}
#endif



